package com.news.model;

import com.news.db.OpDB;

import java.util.Date;

public class News {
    private int id;
    private int info_type; //类别ID
    private String info_title;
    private String info_content;
    private String info_creator;
    private Date info_date;
    private String typeName; //类别名称

    public News() {
    }

    public News(int info_type, String info_title, String info_content, String info_creator) {
        this.info_type = info_type;
        this.info_title = info_title;
        this.info_content = info_content;
        this.info_creator = info_creator;
    }

    public News(int info_type, String info_title, String info_content, String info_creator, int id) {
        this.info_type = info_type;
        this.info_title = info_title;
        this.info_content = info_content;
        this.info_creator = info_creator;
        this.id = id;
    }

    @Override
    public String toString() {
        return "News{" +
                "id=" + id +
                ", info_type=" + info_type +
                ", info_title='" + info_title + '\'' +
                ", info_content='" + info_content + '\'' +
                ", info_creator='" + info_creator + '\'' +
                ", info_date=" + info_date +
                ", typeName='" + typeName + '\'' +
                '}';
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName() {
        OpDB opdb = new OpDB();
        this.typeName = opdb.OpGetTypeName(getInfo_type());
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getInfo_type() {
        return info_type;
    }

    public void setInfo_type(int info_type) {
        this.info_type = info_type;
    }

    public String getInfo_title() {
        return info_title;
    }

    public void setInfo_title(String info_title) {
        this.info_title = info_title;
    }

    public String getInfo_content() {
        return info_content;
    }

    public void setInfo_content(String info_content) {
        this.info_content = info_content;
    }

    public String getInfo_creator() {
        return info_creator;
    }

    public void setInfo_creator(String info_creator) {
        this.info_creator = info_creator;
    }

    public Date getInfo_date() {
        return info_date;
    }

    public void setInfo_date(Date info_date) {
        this.info_date = info_date;
    }

}
